home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / toolpack.000 / toolpack / toolpack1.2 / scriptsource / dapt.s < prev    next >
Encoding:
Text File  |  1993-10-04  |  4.7 KB  |  146 lines

  1. #! /bin/csh
  2. #  dapt is a csh script to convert a REAL (DOUBLE PRECISION) version of
  3. #  a Fortran program to DOUBLE PRECISION (REAL) using ISTPT.
  4. #  The declarative part of the converted program is then rebuilt using ISTDS.
  5. #    (via the combined tool fragments ISTQT = ISTLX/ISTYP/ISTPT
  6. #                                 and ISTDT = ISTYP/ISTDS/ISTPL)
  7. #
  8. #
  9. #  Invocation:
  10. #
  11. #  dapt <s or d> decs_option_file Polish_option_file Fortran_source_file
  12. #
  13. #  If the first argument is "s" ("d") then the Fortran in Fortran_source_file
  14. #  will be transformed to a REAL (DOUBLE PRECISION) version.
  15. #
  16. #  decs_option_file is the name of a file containing template options, one per
  17. #  line.  If decs_option_file is "-" then default decs options will be used.
  18. #
  19. #  Polish_option_file is the name of a file containing Polish options used in
  20. #  reconstructing the transformed Fortran.  If Polish_option_file is "-"
  21. #  then default Polish options will be used.
  22. #
  23. #  Check command line validity.
  24. if ( $#argv < 4 || ( $1 != "s" && $1 != "d" ) ) then
  25. TOOLPACKPATH/toolpack1.2/util/echoerr \
  26. Invocation:
  27. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  28. TOOLPACKPATH/toolpack1.2/util/echoerr \
  29. "dapt <s or d> decs_option_file Polish_option_file Fortran_source_file"
  30. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  31. TOOLPACKPATH/toolpack1.2/util/echoerr \
  32. The first argument is s or d indicating that the transformed
  33. TOOLPACKPATH/toolpack1.2/util/echoerr \
  34. program is to be single or double precision, respectively.
  35. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  36. TOOLPACKPATH/toolpack1.2/util/echoerr \
  37. For information about decs_option_file, see Users\' Guide.
  38. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  39. TOOLPACKPATH/toolpack1.2/util/echoerr \
  40. 'Polish_option_file is created by using script "polx".'
  41. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  42. TOOLPACKPATH/toolpack1.2/util/echoerr \
  43. 'Note: "-" in place of either or both option files gives default options.'
  44. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  45. TOOLPACKPATH/toolpack1.2/util/echoerr \
  46. Transformed code is sent to standard output and may be redirected to a file.
  47. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  48.    exit
  49. endif
  50. #  "-" as decs_option_file gives default options.
  51. if ( $2 != - ) then
  52. #  Check that decs_option_file exists.
  53.    if ( -e $2 == 0 ) then
  54. TOOLPACKPATH/toolpack1.2/util/echoerr \
  55. "'$2' does not exist. '-' as the second argument gives default decs options."
  56.       exit
  57.    endif
  58. endif
  59. #  "-" as Polish_option_file gives default options.
  60. if ( $3 != - ) then
  61. #  Check that Polish_option_file exists.
  62.    if ( -e $3 == 0 ) then
  63. TOOLPACKPATH/toolpack1.2/util/echoerr \
  64. "'$3' does not exist. '-' as the third argument gives default Polish options."
  65.       exit
  66.    endif
  67. endif
  68. #  Check that Fortran_source_file exists.
  69. if ( -e $4 == 0 ) then
  70. TOOLPACKPATH/toolpack1.2/util/echoerr \
  71. "'$4' does not exist."
  72.    exit
  73. endif
  74. #
  75. #  Create PFS.  If PFS already exists, exit with an advisory message.
  76. #
  77. if ( -e _.TOOLPACK == 0 ) then
  78.    mkdir _.TOOLPACK
  79. else
  80. TOOLPACKPATH/toolpack1.2/util/echoerr \
  81. Toolpack-created directory '"_.TOOLPACK"' exists. \
  82. Remove with script '"discard"'.
  83.    exit
  84. endif
  85. #  Make a tab-free copy of the Fortran source and use it as source.
  86. set src = qt.src$$
  87. expand $4 > _.TOOLPACK/$src
  88. #  Output token stream file name.
  89. set tkn = _.qttkn
  90. #  Output comment file name.
  91. set cmt = _.qtcmt
  92. #  Create the inter-process file IST.CMD and append parameters for ISTQT.
  93. if ( $1 == "s" ) then
  94. TOOLPACKPATH/toolpack1.2/util/mkipf \
  95. $src $tkn $cmt 'single'
  96. else
  97. TOOLPACKPATH/toolpack1.2/util/mkipf \
  98. $src $tkn $cmt 'double'
  99. endif
  100. #
  101. #  Invoke ISTQT.
  102. #
  103. TOOLPACKPATH/toolpack1.2/exec/istqt.u
  104. #
  105. #  If tool terminated with errors, advise user to obtain listing.  Exit.
  106. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  107. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  108. TOOLPACKPATH/toolpack1.2/util/echoerr \
  109. 'Errors detected.  Invoke script "getlst" to obtain a listing showing'
  110. TOOLPACKPATH/toolpack1.2/util/echoerr \
  111. statement and token numbers.
  112. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  113.    /bin/rm -r _.TOOLPACK
  114.    exit
  115. endif
  116. #  Create the inter-process file IST.CMD and append parameters for ISTDT.
  117. if ( $2 == - ) then
  118.    set decsoptfile = 'mode=rebuild_declaratives'
  119. else
  120.    set decsoptfile = `cat $2`
  121. endif
  122. if ( $3 == - ) then
  123. TOOLPACKPATH/toolpack1.2/util/mkipf \
  124. $tkn $cmt \#1 "$decsoptfile" -
  125. else
  126. TOOLPACKPATH/toolpack1.2/util/mkipf \
  127. $tkn $cmt \#1 "$decsoptfile" \#$3
  128. endif
  129. #
  130. #  Invoke ISTDT.
  131. #
  132. TOOLPACKPATH/toolpack1.2/exec/istdt.u
  133. #
  134. #  If tool terminated with errors, advise user to obtain listing.
  135. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  136. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  137. TOOLPACKPATH/toolpack1.2/util/echoerr \
  138. 'Errors detected.  Invoke script "getlst" to obtain a listing showing'
  139. TOOLPACKPATH/toolpack1.2/util/echoerr \
  140. statement and token numbers.
  141. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  142. endif
  143. #
  144. /bin/rm -r _.TOOLPACK
  145. #
  146.